<?php
	/* Description: This file is used to add sub sub category. */
	#########IncludeFiles####################################################################################
	include_once '../inc/config.php';
	include_once("../inc/bootstrape.php");
	require_once _SITE_PATH_.'classes/Vendor/Vendor.php';
	require_once _SITE_PATH_.'classes/Master/Master.php';
	require_once _SITE_PATH_.'classes/Product/Product.php';
	require_once _SITE_PATH_.'classes/Content/Content.php';
	require_once _SITE_PATH_.'classes/CommonUtility/CommonUtility.php';

	if( $_POST['submit']=='Submit'){   
		
		$parms['title'] = $_POST['title'];
		$parms['entity_type'] = $_POST['entity_type'];
		
		if($parms['entity_type'] == 1){
			$parms['entity_id'] = $_POST['service'];
		}else if($parms['entity_type'] == 2){
			$parms['entity_id'] = $_POST['product'];
		}
		
		$parms['summary'] = $_POST['summary'];
		$parms['description'] = $_POST['description'];
		$parms['added'] = date("Y-m-d");
	 					
		if( CommonUtility::insertData($parms, 'news')) {        
			header("Location: news_mng.php?msg=1604");            
			exit;
		}
		$err = 1605;    
	}
	
	$editor = CommonUtility::includeEditor();
	
	$products = array();
	$products = Product::getActiveProducts();
	
	$services = array();
	$services = Master::getActiveServices();
	
	$errMsg = $err;
	$_tplName = 'content/news_add.tpl';
	$_title = 'Add News';

	require_once _ADMIN_TPL_MAIN_;
?>